namespace IAM.Interface.Model
{
    using IAM.Interface.Model.Interface;
    using System;
    using System.Reflection;
    using System.Text;

    public class UserACI : AbstractConvertObject, IConvertXml
    {
        private IAM.Interface.Model.AccountInfo _accountinfo = null;
        private IAM.Interface.Model.ACISessions _acisessions = null;

        public override object ConvertToObject()
        {
            this.AccountInfo = new IAM.Interface.Model.AccountInfo();
            this.AccountInfo.CurrentXmlNode = this.CurrentXmlNode.SelectSingleNode("AccountInfo");
            this.AccountInfo = (IAM.Interface.Model.AccountInfo) this.AccountInfo.ConvertToObject();
            this.ACISessions = new IAM.Interface.Model.ACISessions();
            this.ACISessions.CurrentXmlNode = this.CurrentXmlNode.SelectSingleNode("ACISessions");
            this.ACISessions = (IAM.Interface.Model.ACISessions) this.ACISessions.ConvertToObject();
            return this;
        }

        public override bool Equals(object obj)
        {
            UserACI ua = null;
            try
            {
                ua = (UserACI) obj;
            }
            catch
            {
                return false;
            }
            bool result = true;
            if (!this.AccountInfo.Equals(ua.AccountInfo))
            {
                result = false;
            }
            else if (!this.ACISessions.Equals(ua.ACISessions))
            {
                result = false;
            }
            return result;
        }

        public override int GetHashCode()
        {
            int result = 1;
            foreach (PropertyInfo onofpi in base.GetType().GetProperties())
            {
                result += onofpi.GetHashCode();
            }
            return result;
        }

        public IAM.Interface.Model.AccountInfo AccountInfo
        {
            get
            {
                return this._accountinfo;
            }
            set
            {
                this._accountinfo = value;
            }
        }

        public IAM.Interface.Model.ACISessions ACISessions
        {
            get
            {
                return this._acisessions;
            }
            set
            {
                this._acisessions = value;
            }
        }

        public string XML
        {
            get
            {
                return (this.XMLBoday + this.XMLFinis);
            }
        }

        public string XMLBoday
        {
            get
            {
                StringBuilder _xml = new StringBuilder();
                _xml.Append(" <UserACI>");
                _xml.Append(this.AccountInfo.XML);
                _xml.Append(this.ACISessions.XML);
                return _xml.ToString();
            }
        }

        public string XMLFinis
        {
            get
            {
                return "</UserACI>";
            }
        }
    }
}

